package com.cncytech.uiautomator_demo.testcase;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;

import com.cncytech.uiautomator_demo.BaseTest;
import com.cncytech.uiautomator_demo.RetryWatcher;
import com.cncytech.uiautomator_demo.TestConstant;
import com.cncytech.uiautomator_demo.utils.Describe;

import org.junit.Rule;
import org.junit.Test;

public class ApnMgrPoliciesTest extends BaseTest {

    @Rule
    public RetryWatcher retryWatcher = new RetryWatcher(TestConstant.retryCount);

    @Test
    @Describe(TestConstant.APN_FORBIDDEN)
    public void apnMgrForbiddenTest() {
        String msg = TestConstant.APN_FORBIDDEN + TestConstant.FAILURE;
        int status = 0;
        assertThat(msg, tm.setUserApnMgrPolicies(status));

        int userApnMgrPolicies = tm.getUserApnMgrPolicies();
        assertThat(msg, userApnMgrPolicies, is(status));
    }
    @Test
    @Describe(TestConstant.APN_READONLY)
    public void apnMgrReadOnlyTest() {
        String msg = TestConstant.APN_READONLY + TestConstant.FAILURE;
        int status = 1;
        assertThat(msg, tm.setUserApnMgrPolicies(status));

        int userApnMgrPolicies = tm.getUserApnMgrPolicies();
        assertThat(msg, userApnMgrPolicies, is(status));
    }

    @Test
    @Describe(TestConstant.APN_ENABLE)
    public void apnMgrEnableTest() {
        String msg = TestConstant.APN_ENABLE + TestConstant.FAILURE;
        int status = 2;
        assertThat(msg, tm.setUserApnMgrPolicies(status));

        int userApnMgrPolicies = tm.getUserApnMgrPolicies();
        assertThat(msg, userApnMgrPolicies, is(status));
    }
}
